import "package:flutter/material.dart";
import 'package:login_demo/app_theme.dart';
// desc: 验证码单个
class SmsCodeItem extends StatefulWidget {
  SmsCodeItem({
    Key key,
    this.textEditingController,
    this.focusNode,
    this.onChange,
  }) : super(key: key);
  TextEditingController textEditingController;
  FocusNode focusNode;
  Function onChange;

  @override
  _SmsCodeItemState createState() => _SmsCodeItemState();
}

class _SmsCodeItemState extends State<SmsCodeItem> {
  @override
  Widget build(BuildContext context) {
    return Container(
      width: 50,
      height: 50,
      color: AppTheme.hintGrey.withOpacity(0.7),
      child: Row(
        children: [
          Expanded(
            child: TextField(
              focusNode: widget.focusNode,
              controller: widget.textEditingController,
              decoration: InputDecoration(
                  border: InputBorder.none,
                  isDense: true,
                  contentPadding: EdgeInsets.only(top: 5, bottom: 5, left: 20, right: 5)
              ),
              onChanged: (value){
                if(widget.onChange != null){
                  widget.onChange(value);
                }
              },
            )
          )
        ],
      ),
    );
  }
}